﻿var arrRefFunctions = new Array();

//**************************************************
function getControlValue(controlName) {
  var mValue = new String()
  mValue = document.getElementById(controlName).value
  return mValue
}
//**************************************************
function DoCallBack(functionName, functionArguments, endFunction, context) {
  var vstateID = document.getElementById("__VIEWSTATEID");
  var vstateData;
  if (vstateID != null) {
    vstateID = vstateID.value;
  }
  if (vstateID != null && vstateID.length > 0) {
    vstateData = document.getElementById(vstateID);
  }
  if (vstateData != null) {
    vstateData = vstateData.value;
  }
  if (vstateData == null) {
    vstateData = "";
  }
  __theFormPostData = "__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=&" + vstateID + "=" + vstateData + "&";

  WebForm_DoCallback('__Page', functionName + '|' + functionArguments, endFunction, context, callback_Error, false)
}
/***************************/
function callback_Error(message, context) {
  //alert(message)
}

var mFormData = null
//**************************************************
function DoFormCallBack(functionName, functionArguments, endFunction) {

    mFormData = new String()
  
  InitFormCallback()

  __theFormPostData = "__FORMCALLBACK=1&__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=&" + mFormData
  WebForm_DoCallback('__Page', functionName + "|" + functionArguments, endFunction, null, null, false)
}
//**************************************************
function InitFormCallback() {
  var count = theForm.elements.length;
  var element;
  for (var i = 0; i < count; i++) {
    element = theForm.elements[i];
    var tagName = element.tagName.toLowerCase();
    if (tagName == "input") {
      var type = element.type;

      if ((type == "text" || type == "hidden" || type == "password" || ((type == "checkbox" || type == "radio") && element.checked)) && (element.id != "__EVENTVALIDATION" && element.id != "__VIEWSTATE" && element.id != "__EVENTTARGET" && element.id != "__EVENTARGUMENT")) {

        InitCallbackAddField(element.name, element.value);
      }
    }
    else if (tagName == "select") {
      var selectCount = element.options.length;
      for (var j = 0; j < selectCount; j++) {
        var selectChild = element.options[j];
        if (selectChild.selected == true) {
          InitCallbackAddField(element.name, element.value);
        }
      }
    }
    else if (tagName == "textarea") {
      InitCallbackAddField(element.name, element.value);
    }
}
  
}
//**************************************************
function InitCallbackAddField(name, value) {
  mFormData += name + "=" + WebForm_EncodeCallback(value) + "&";
}
